(() => {
    class Person {
        name: string
        sex: string
        constructor(name: string, sex: string) {
            this.name = name;
            this.sex = sex
        }
        sayHi() {
            console.log(`我叫${this.name},性别${this.sex}`);
        }
    }
    class Student extends Person {
        constructor(name: string, sex: string) {
            super(name, sex)
        }
        //重写父类中方法
        sayHi() {
            super.sayHi()
        }
    }
    const person1 = new Person("小明", "男")
    person1.sayHi()
    const person2 = new Person("大明", "女")
    person2.sayHi()
})()